package password

import (
	"encoding/json"
	"fmt"
	"os"
)

var (
	passwordJSON string = "./config/password.json"
	MyPasswords  Passwords
)

type Passwords struct {
	CreateBlog string `json:"createBlog"`
	ModifyBlog string `json:"modifyBlog"`
	DeleteBlog string `json:"deleteBlog"`
}

func init() {
	file, err := os.Open(passwordJSON)
	if err != nil {
		fmt.Println("打开密码配置错误")
		os.Exit(-1)
	}
	defer file.Close()
	decoder := json.NewDecoder(file)

	err = decoder.Decode(&MyPasswords)
	if err != nil {
		fmt.Println("密码配置解析错误")
		os.Exit(-1)
	}
}
